package com.runfast.waimai.dao.model;

import com.fasterxml.jackson.annotation.JsonIgnore;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.util.Date;

public class RunfastGalleryCategory implements Serializable {

    public interface Insert{}

    public interface Modify{}


    @Null(message = "传入参数错误",groups = {Insert.class})
    @NotNull(message = "图库类别ID错误",groups = {Modify.class})
    private Integer id;

    /**
     * 名称
     */
    @Size(min = 1,max = 60,message = "图库类别名称错误",groups = {Insert.class, Modify.class})
    private String name;

    /**
     * 父节点ID
     */
    private Integer parentid;

    /**
     * 排序值
     */
    private Integer sort;

    /**
     * 更新时间
     */
    @JsonIgnore
    private Date updatetime;

    /**
     * 创建时间
     */
    private Date createtime;

    /**
     * 删除 0:未删除  1:删除
     */
    @JsonIgnore
    private Boolean del;

    private static final long serialVersionUID = 1L;

    public Integer getId() {
        return id;
    }

    public RunfastGalleryCategory withId(Integer id) {
        this.setId(id);
        return this;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public RunfastGalleryCategory withName(String name) {
        this.setName(name);
        return this;
    }

    public void setName(String name) {
        this.name = name == null ? null : name.trim();
    }

    public Integer getParentid() {
        return parentid;
    }

    public RunfastGalleryCategory withParentid(Integer parentid) {
        this.setParentid(parentid);
        return this;
    }

    public void setParentid(Integer parentid) {
        this.parentid = parentid;
    }

    public Integer getSort() {
        return sort;
    }

    public RunfastGalleryCategory withSort(Integer sort) {
        this.setSort(sort);
        return this;
    }

    public void setSort(Integer sort) {
        this.sort = sort;
    }

    public Date getUpdatetime() {
        return updatetime;
    }

    public RunfastGalleryCategory withUpdatetime(Date updatetime) {
        this.setUpdatetime(updatetime);
        return this;
    }

    public void setUpdatetime(Date updatetime) {
        this.updatetime = updatetime;
    }

    public Date getCreatetime() {
        return createtime;
    }

    public RunfastGalleryCategory withCreatetime(Date createtime) {
        this.setCreatetime(createtime);
        return this;
    }

    public void setCreatetime(Date createtime) {
        this.createtime = createtime;
    }

    public Boolean getDel() {
        return del;
    }

    public RunfastGalleryCategory withDel(Boolean del) {
        this.setDel(del);
        return this;
    }

    public void setDel(Boolean del) {
        this.del = del;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", name=").append(name);
        sb.append(", parentid=").append(parentid);
        sb.append(", sort=").append(sort);
        sb.append(", updatetime=").append(updatetime);
        sb.append(", createtime=").append(createtime);
        sb.append(", del=").append(del);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}